{% extends "layout.html" %}
{% from "_formhelpers.html" import render_field %}
{% from "_formhelpers.html" import render_navigation %}

{% block body %}

  <div>
    <table>
      <thead>
      <tr>
        <th>Title</th>
        <th>Text</th>
        <th>Done</th>
        <th>Publication date</th>
      </tr>
      </thead>
      <tbody>
      {% for todo in todos_page.items %}
        <tr>
          <td>{{ todo.title }}</td>
          <td>{{ todo.text }}</td>
          <td>{{ todo.done }}</td>
          <td>{{ todo.pub_date }}</td>
        </tr>
      {% endfor %}
      </tbody>
    </table>
  </div>
  <div>
    {{ render_navigation(todos_page, "pagination") }}
  </div>
  <div>
    <form method="POST" action="{{ url_for("pagination") }}">
      {% for field in form %}
        {{ render_field(field, style='font-weight: bold') }}
      {% endfor %}
      <input type="submit" value="Create">
    </form>
  </div>

{% endblock %}
